<?php

if(!function_exists('plugins'))
{
    function plugins($name = 'admin'){
        $objName = explode("::" , $name);
        $plugin = array_shift($objName);
        $name   =   array_shift($objName);
        $suffx  = Config("route.controller_suffix")? ucfirst(Config("route.controller_layer")) : '';
        $namespace = "plugins\\{$plugin}\\controller\\{$name}{$suffx}";
        if(class_exists($namespace))
        {
            App()->setAppPath(App()->getRootPath() . "plugins/{$plugin}/");
           return invoke($namespace);
//            return $namespace;
        }

        return  null;
    }
}